<crm-main-nav  nav-c="manage" page-title="人员管理"></crm-main-nav>
<div class="container ng-scope clearfix">
	<ol class="breadcrumb">
		<li>CRM系统</li>
		<li>系统管理</li>
		<li class="active">人员管理</li>
	</ol>
</div>
<crm-panel title="人员管理" ng-app="controllers">
	<div ng-controller="managePeopleController">
	    <div class="panel-body"> 
			<form class="form-horizontal" ng-submit="staffSearch()" role="form">
				<div class="form-group row">
					<label class="col-sm-1 control-label">分公司：</label>
					<div class="col-sm-2">
						<company-select current-id="company"></company-select>
					</div>
					<div class="col-sm-1">
						<button type="submit" class="btn btn-primary">确定</button>
					</div>
				</div>
			</form>
	      <!-- 结果表格 -->
		    <form method="get" ng-submit="submitForm()">			
		      	<table class="table table-bordered" id="table_list">
			        <thead>
						<tr>        
							<th>姓名</th>
							<th>账号</th>
							<th>分公司</th>
							<th>职位</th>
							<th>人员类型</th>
							<th>联系方式</th>
							<th ng-if="user.type>=4">操作</th>
						</tr>
			        </thead>
			        <tbody>
			          	<tr class="col" ng-repeat="v in data track by $index" >
				            <td>{{v.name}}</td>
				            <td>{{v.account}}</td>
				            <td>{{v.company_name}}</td>
				            <td>{{v.position}}</td>
				            <td ng-if="v.type==1">销售人员</td>
				            <td ng-if="v.type==2">渠道经理</td>
				            <td ng-if="v.type==3">经理</td>
				            <td ng-if="v.type==4">副总</td>
				            <td ng-if="v.type==5">管理员</td>
				            <td>{{v.phone}}</td>
				            <td ng-if="user.type>=4">
				            	<input type="button" class="btn btn-default btn-sm" value="设置" ng-click="set(v)">
				            	<input type="button" ng-if="v.type<user.type" class="btn btn-default btn-sm" value="删除" ng-click="del(v)">
			            	</td>
			          	</tr>
			        </tbody>
		      	</table>
	      	</form>
		      <!-- 模态框 -->
		    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-dialog">
			    <div class="modal-content">
			      	<div class="modal-header">
			        	<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
			        	<h4 class="modal-title" id="myModalLabel">修改</h4>
			      	</div>
			      	<div class="modal-body">
				      	<div class="alert alert-warning" role="alert">
					    	提示：修改时确保相关信息填写正确！
					    </div>
			       		<form class="form-horizontal row"  ng-submit="setForm()" id="set_form">
			        		<div class="form-group col-sm-6">
								<label class="col-sm-4 control-label">姓名：</label>
								<div class="col-sm-8">
									<input type="text" class='form-control' ng-model="setData.name">	
								</div>
		        			</div>
							<div class="form-group col-sm-6">
								<label class="col-sm-4 control-label">分公司：</label>
								<div class="col-sm-8">
									<company-select current-id="setData.company"></company-select>
								</div>
							</div>
			          		<div class="form-group col-sm-6" ng-if="user.type>=4&&setData.id!=user.id&&setData.type<user.type">
				            	<label class="col-sm-4 control-label">人员类型：</label>
				            	<div class="col-sm-8">
				            		<staff-select current-id="setData.type"></staff-select>
				            	</div>
			            	</div>
			            	<div class="form-group col-sm-6" ng-if="user.type>=4&&setData.id!=user.id&&setData.type<user.type">
				            	<label class="col-sm-4 control-label">人员职位：</label>
				            	<div class="col-sm-8">
				            		<input type="text" class='form-control' ng-model="setData.position">
				            	</div>
			            	</div>
			            	<div class="form-group col-sm-6">
				            	<label class="col-sm-4 control-label">联系方式：</label>
				            	<div class="col-sm-8">
									<input type="text" class='form-control' ng-model="setData.phone">
								</div>
							</div> 
			        	</form>
			     	</div>
			      	<div class="modal-footer">
				        <button type="button" class="btn btn-primary" ng-click="setForm()">确定</button>
				        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			      	</div>
			    </div>
		  	</div>
		</div>
    </div>
</div>
</crm-panel>
